package cn.wenhaha.app.mapping.bean.dto;

import cn.wenhaha.app.mapping.bean.validator.CoreSourceContain;
import cn.wenhaha.app.mapping.bean.validator.Cron;
import cn.wenhaha.app.mapping.bean.validator.DataSourceContain;
import lombok.Data;

import javax.validation.Valid;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;

/**
 * 同步对象
 * --------
 *
 * @author ：wyndem
 * @Date ：Created in 2022-08-06 11:25
 */
@Data
public class SyncObjectContext {

    private String id;

    @NotEmpty(message = "名称不能为空")
    private String name;

    @NotEmpty(message = "corn不能为空")
    @Cron
    private String cron;

    /** 同步对象的API名称 **/
    @NotEmpty(message = "对象1名称不能为空")
    private  String source1ObjApi;
    @NotEmpty(message = "对象2名称不能为空")
    private  String source2ObjApi;

    /** 同步数据源code1  **/
    @NotEmpty(message = "同步数据源1不能为空")
    @DataSourceContain
    private String source1;

    /** 同步数据源code2 **/
    @NotEmpty(message = "同步数据源2不能为空")
    @DataSourceContain
    private String source2;

    /** 同步数据源账号Id和名称**/
    @NotEmpty(message = "数据源1账号不能为空")
    private String source1Id;
    private String source1Name;
    @NotEmpty(message = "数据源2账号不能为空")
    private String source2Id;
    private String source2Name;


    /** 插件id **/
    @NotEmpty(message = "插件id账号不能为空")
    @CoreSourceContain
    private  String syncCore1;
    @NotEmpty(message = "插件id账号不能为空")
    @CoreSourceContain
    private  String syncCore2;

    /** 映射 **/
    @NotNull(message = "映射不能为空")
    @Valid
    private MappingContext mapping;

    /** 配置 **/
    @NotNull(message = "配置不能为空")
    private ConfigContext config;



}
